import os
import time

from selenium import webdriver
from selenium.webdriver.common.by import By


class Drop_down:
    def __init__(self):
        # 打开Chrome浏览器
        self.driver = webdriver.Chrome()
        self.driver.maximize_window()
        # 打开链接
        self.link = 'file:///' + os.path.abspath('注册实例.html')
        self.driver.get(self.link)

    def ordinary(self):
        # 定位下拉栏
        time.sleep(2)
        select = self.driver.find_element(By.ID, 'select')
        # 点击对应的下拉选项
        time.sleep(2)
        select.find_elements(By.CSS_SELECTOR,'option')[2].click()


if __name__ == '__main__':
    drop_down = Drop_down()
    drop_down.ordinary()
    time.sleep(2)
    drop_down.driver.quit()